CC= gcc
CFLAGS= -std=gnu99 -O2
#CFLAGS= -std=gnu99 -g
#CFLAGS= -std=gnu99 -g -DMTRACE # Useful for finding memory leaks, not overflowsZZ
LIBS=

all: captivequeens trigon trigonleft canfield

captivequeens: main.o captivequeens.o blind.o found.o random.o stack.o stock.o \
    waste.o riffle.o notableau.o nocourse.o
	$(CC) -o captivequeens $(CFLAGS) main.o captivequeens.o blind.o \
	    found.o random.o stack.o stock.o waste.o riffle.o notableau.o \
	    nocourse.o $(LIBS)

blockten: main.o blockten.o random.o stack.o riffle.o
	$(CC) -o blockten $(CFLAGS) main.o blockten.o random.o stack.o \
	    riffle.o $(LIBS)

simplepairs: main.o simplepairs.o random.o stack.o riffle.o
	$(CC) -o simplepairs $(CFLAGS) main.o simplepairs.o random.o stack.o \
	    riffle.o $(LIBS)

tens: main.o tens.o random.o stack.o riffle.o
	$(CC) -o tens $(CFLAGS) main.o tens.o random.o stack.o riffle.o $(LIBS)

elevens: main.o elevens.o random.o stack.o riffle.o
	$(CC) -o elevens $(CFLAGS) main.o elevens.o random.o stack.o \
	    riffle.o $(LIBS)

nines: main.o nines.o random.o stack.o riffle.o
	$(CC) -o nines $(CFLAGS) main.o nines.o random.o stack.o \
	    riffle.o $(LIBS)

thirteens: main.o thirteens.o random.o stack.o riffle.o
	$(CC) -o thirteens $(CFLAGS) main.o thirteens.o random.o stack.o \
	    riffle.o $(LIBS)

suitelevens: main.o suitelevens.o random.o stack.o riffle.o
	$(CC) -o suitelevens $(CFLAGS) main.o suitelevens.o random.o stack.o \
	    riffle.o $(LIBS)

fifteens: main.o fifteens.o random.o stack.o riffle.o visited.o
	$(CC) -o fifteens $(CFLAGS) main.o fifteens.o random.o stack.o \
	    riffle.o visited.o $(LIBS)

captivekings: main.o captivekings.o blind.o found.o random.o stack.o stock.o \
    waste.o riffle.o notableau.o
	$(CC) -o captivekings $(CFLAGS) main.o captivekings.o blind.o \
	    found.o random.o stack.o stock.o waste.o riffle.o notableau.o $(LIBS)

cq: main.o cq.o blind.o found.o random.o stack.o stock.o \
    waste.o riffle.o notableau.o
	$(CC) -o cq $(CFLAGS) main.o cq.o blind.o notableau.o \
	    found.o random.o stack.o stock.o waste.o riffle.o $(LIBS)

trigon: main.o trigon.o dfs.o found.o random.o stack.o nostock.o tableau.o \
    bouquet.o riffle.o visited.o nowaste.o
	$(CC) -o trigon $(CFLAGS) main.o trigon.o dfs.o found.o random.o \
	    tableau.o stack.o nostock.o bouquet.o riffle.o visited.o nowaste.o \
	    $(LIBS)

golf: main.o golf.o dfs.o course.o random.o stack.o stock.o tableau.o \
    nobouquet.o riffle.o visited.o nowaste.o nofound.o
	$(CC) -o golf $(CFLAGS) main.o golf.o dfs.o course.o random.o \
	    tableau.o stack.o stock.o nobouquet.o riffle.o visited.o \
	    nowaste.o nofound.o $(LIBS)

panther: main.o panther.o dfs.o course.o random.o stack.o stock.o tableau.o \
    nobouquet.o riffle.o visited.o nowaste.o nofound.o
	$(CC) -o panther $(CFLAGS) main.o panther.o dfs.o course.o random.o \
	    tableau.o stack.o stock.o nobouquet.o riffle.o visited.o \
	    nowaste.o nofound.o $(LIBS)

blackhole: main.o blackhole.o dfs.o course.o random.o stack.o nostock.o \
    tableau.o nobouquet.o riffle.o visited.o nowaste.o nofound.o
	$(CC) -o blackhole $(CFLAGS) main.o blackhole.o dfs.o course.o \
	    random.o tableau.o stack.o nostock.o nobouquet.o riffle.o \
	    visited.o nowaste.o nofound.o $(LIBS)

binarystar: main.o binarystar.o dfs.o course.o random.o stack.o nostock.o \
    tableau.o nobouquet.o riffle.o visited.o nowaste.o nofound.o
	$(CC) -o binarystar $(CFLAGS) main.o binarystar.o dfs.o course.o \
	    random.o tableau.o stack.o nostock.o nobouquet.o riffle.o \
	    visited.o nowaste.o nofound.o $(LIBS)

allinarow: main.o allinarow.o dfs.o course.o random.o stack.o nostock.o \
    tableau.o nobouquet.o riffle.o visited.o nowaste.o nofound.o
	$(CC) -o allinarow $(CFLAGS) main.o allinarow.o dfs.o course.o \
	    random.o tableau.o stack.o nostock.o nobouquet.o riffle.o \
	    visited.o nowaste.o nofound.o $(LIBS)

fishwrap: main.o fishwrap.o dfs.o course.o random.o stack.o nostock.o \
    tableau.o nobouquet.o riffle.o visited.o nowaste.o nofound.o
	$(CC) -o fishwrap $(CFLAGS) main.o fishwrap.o dfs.o course.o \
	    random.o tableau.o stack.o nostock.o nobouquet.o riffle.o \
	    visited.o nowaste.o nofound.o $(LIBS)

canfield: main.o canfield.o dfs.o found.o random.o stack.o nostock.o tableau.o \
    bouquet.o riffle.o visited.o nowaste.o
	$(CC) -o canfield $(CFLAGS) main.o canfield.o dfs.o found.o random.o \
	    tableau.o stack.o nostock.o bouquet.o riffle.o visited.o \
	    nowaste.o $(LIBS)

canfield2: main.o canfield-finite.o dfs.o found.o random.o stack.o stock.o \
    tableau.o nobouquet.o riffle.o visited.o waste.o nocourse.o
	$(CC) -o canfield2 $(CFLAGS) main.o canfield-finite.o dfs.o found.o \
	    random.o tableau.o stack.o stock.o nobouquet.o riffle.o visited.o \
	    waste.o nocourse.o $(LIBS)

storehouse: main.o storehouse.o dfs.o found.o random.o stack.o stock.o \
    tableau.o waste.o riffle.o visited.o nobouquet.o nocourse.o
	$(CC) -o storehouse $(CFLAGS) main.o storehouse.o dfs.o found.o \
	    random.o tableau.o stack.o stock.o waste.o riffle.o visited.o \
	    nobouquet.o nocourse.o $(LIBS)

36: main.o 36.o dfs.o found.o random.o stack.o stock.o \
    tableau.o waste.o riffle.o visited.o nobouquet.o nocourse.o
	$(CC) -o 36 $(CFLAGS) main.o 36.o dfs.o found.o \
	    random.o tableau.o stack.o stock.o waste.o riffle.o visited.o \
	    nobouquet.o nocourse.o $(LIBS)

acme: main.o acme.o dfs.o found.o random.o stack.o stock.o \
    tableau.o waste.o riffle.o visited.o nobouquet.o nocourse.o
	$(CC) -o acme $(CFLAGS) main.o acme.o dfs.o found.o \
	    random.o tableau.o stack.o stock.o waste.o riffle.o visited.o \
	    nobouquet.o nocourse.o $(LIBS)

coyote: main.o coyote.o dfs.o found.o random.o stack.o stock.o \
    tableau.o waste.o riffle.o visited.o nobouquet.o nocourse.o
	$(CC) -o coyote $(CFLAGS) main.o coyote.o dfs.o found.o \
	    random.o tableau.o stack.o stock.o waste.o riffle.o visited.o \
	    nobouquet.o nocourse.o $(LIBS)


agness: main.o agness.o dfs.o found.o random.o stack.o stock.o \
    tableau.o nowaste.o riffle.o visited.o nobouquet.o nocourse.o
	$(CC) -o agness $(CFLAGS) main.o agness.o dfs.o found.o \
	    random.o tableau.o stack.o stock.o nowaste.o riffle.o visited.o \
	    nobouquet.o nocourse.o $(LIBS)

kiev: main.o kiev.o dfs.o found.o random.o stack.o stock.o \
    tableau.o nowaste.o riffle.o visited.o nobouquet.o nocourse.o
	$(CC) -o kiev $(CFLAGS) main.o kiev.o dfs.o found.o \
	    random.o tableau.o stack.o stock.o nowaste.o riffle.o visited.o \
	    nobouquet.o nocourse.o $(LIBS)

scorpion: main.o scorpion.o dfs.o found.o random.o stack.o stock.o \
    tableau.o nowaste.o riffle.o visited.o nobouquet.o nocourse.o
	$(CC) -o scorpion $(CFLAGS) main.o scorpion.o dfs.o found.o \
	    random.o tableau.o stack.o stock.o nowaste.o riffle.o visited.o \
	    nobouquet.o nocourse.o $(LIBS)

3blindmice: main.o 3blindmice.o dfs.o found.o random.o stack.o bouquet.o \
    tableau.o nowaste.o riffle.o visited.o nostock.o nocourse.o
	$(CC) -o 3blindmice $(CFLAGS) main.o 3blindmice.o dfs.o found.o \
	    random.o tableau.o stack.o bouquet.o nowaste.o riffle.o visited.o \
	    nostock.o nocourse.o $(LIBS)

alibaba: main.o alibaba.o dfs.o found.o random.o stack.o stock.o \
    tableau.o waste.o riffle.o visited.o bouquet.o nocourse.o
	$(CC) -o alibaba $(CFLAGS) main.o alibaba.o dfs.o found.o \
	    random.o tableau.o stack.o stock.o waste.o riffle.o visited.o \
	    bouquet.o nocourse.o $(LIBS)

40and8: main.o 40and8.o dfs.o found.o random.o stack.o stock.o \
    tableau.o waste.o riffle.o visited.o nobouquet.o nocourse.o
	$(CC) -o 40and8 $(CFLAGS) main.o 40and8.o dfs.o found.o \
	    random.o tableau.o stack.o stock.o waste.o riffle.o visited.o \
	    nobouquet.o nocourse.o $(LIBS)

indef: main.o indefatigable.o dfs.o found.o random.o stack.o \
    bitableau.o riffle.o visited.o nobouquet.o nostock.o nowaste.o
	$(CC) -o indef $(CFLAGS) main.o indefatigable.o dfs.o found.o \
	    random.o bitableau.o stack.o riffle.o visited.o nobouquet.o \
	   nostock.o nowaste.o $(LIBS)

fortress: main.o fortress.o dfs.o found.o random.o stack.o \
    bitableau.o riffle.o visited.o nobouquet.o nostock.o nowaste.o
	$(CC) -o fortress $(CFLAGS) main.o fortress.o dfs.o found.o \
	    random.o bitableau.o stack.o riffle.o visited.o nobouquet.o \
	   nostock.o nowaste.o $(LIBS)

shamrocks: main.o shamrocks.o dfs.o found.o random.o stack.o \
    bitableau.o riffle.o visited.o nobouquet.o nostock.o nowaste.o
	$(CC) -o shamrocks $(CFLAGS) main.o shamrocks.o dfs.o found.o \
	    random.o bitableau.o stack.o riffle.o visited.o nobouquet.o \
	   nostock.o nowaste.o $(LIBS)

indef2: main.o indef2.o dfs_redeal.o found.o random.o stack.o \
    bitableau.o riffle.o visited.o nobouquet.o nostock.o nowaste.o
	$(CC) -o indef2 $(CFLAGS) main.o indef2.o dfs_redeal.o found.o \
	    random.o bitableau.o stack.o riffle.o visited.o nobouquet.o \
	   nostock.o nowaste.o $(LIBS)

cruel: main.o cruel.o dfs_redeal.o found.o random.o stack.o \
    tableau.o riffle.o visited.o nobouquet.o nostock.o nowaste.o
	$(CC) -o cruel $(CFLAGS) main.o cruel.o dfs_redeal.o found.o \
	    random.o tableau.o stack.o riffle.o visited.o nobouquet.o \
	   nostock.o nowaste.o $(LIBS)

trigonleft: main.o trigonleft.o dfs.o found.o random.o stack.o nostock.o \
    tableau.o bouquet.o riffle.o visited.o nowaste.o
	$(CC) -o trigonleft $(CFLAGS) main.o trigonleft.o dfs.o found.o \
	    random.o tableau.o stack.o nostock.o bouquet.o riffle.o visited.o \
	    nowaste.o
	    $(LIBS)

doubletrigon: main.o doubletrigon.o dfs.o found.o random.o stack.o nostock.o \
    tableau.o bouquet.o riffle.o visited.o nowaste.o
	$(CC) -o doubletrigon $(CFLAGS) main.o doubletrigon.o dfs.o found.o \
	    random.o tableau.o stack.o nostock.o bouquet.o riffle.o visited.o \
	    nowaste.o $(LIBS)

inversions: main.o inversions.o stack.o random.o riffle.o
	$(CC) -o inversions $(CFLAGS) main.o inversions.o stack.o riffle.o \
	    random.o $(LIBS)

cons: main.o cons.o stack.o random.o riffle.o
	$(CC) -o cons $(CFLAGS) main.o cons.o stack.o riffle.o \
	    random.o $(LIBS)

randtest: test.o random.o
	$(CC) -o randtest $(CFLAGS) test.o random.o $(LIBS)

adjperm: adjperm.o
	$(CC) -o adjperm $(CFLAGS) adjperm.o $(LIBS)

main.o: main.c stack.h game.h
stack.o: stack.c stack.h
riffle.o: riffle.c stack.h
random.o: random.c stack.h
bsdrandom.o: bsdrandom.c stack.h

blind.o: blind.c stack.h solve.h game.h
dfs.o: dfs.c stack.h solve.h game.h dfs.h
dfs_redeal.o: dfs_redeal.c stack.h solve.h game.h dfs.h

visited.o: visited.c stack.h uthash.h

found.o: found.c stack.h found.h
course.o: course.c stack.h course.h
stock.o: stock.c stack.h stock.h waste.h solve.h
nostock.o: nostock.c stack.h stock.h
waste.o: waste.c stack.h waste.h
nowaste.o: nowaste.c stack.h waste.h
bouquet.o: bouquet.c stack.h bouquet.h
nobouquet.o: nobouquet.c stack.h bouquet.h
nofound.o: nofound.c stack.h found.h
nocourse.o: nocourse.c stack.h course.h
tableau.o: tableau.c stack.h tableau.h
notableau.o: notableau.c stack.h tableau.h

captivequeens.o: captivequeens.c stack.h waste.h solve.h game.h
captivekings.o: captivekings.c stack.h waste.h solve.h game.h
trigon.o: trigon.c stack.h bouquet.h tableau.h solve.h game.h
trigonleft.o: trigonleft.c stack.h bouquet.h tableau.h solve.h game.h
cq.o: cq.c stack.h waste.h solve.h game.h
doubletrigon.o: doubletrigon.c stack.h bouquet.h tableau.h solve.h game.h
canfield.o: canfield.c stack.h bouquet.h tableau.h solve.h game.h
canfield-finite.o: canfield-finite.c stack.h bouquet.h tableau.h solve.h game.h
storehouse.o: storehouse.c stack.h bouquet.h tableau.h solve.h game.h
36.o: 36.c stack.h bouquet.h tableau.h solve.h game.h
acme.o: acme.c stack.h bouquet.h tableau.h solve.h game.h
coyote.o: coyote.c stack.h bouquet.h tableau.h solve.h game.h
alibaba.o: alibaba.c stack.h bouquet.h tableau.h solve.h game.h
40and8.o: 40and8.c stack.h bouquet.h tableau.h solve.h game.h
indefatigable.o: indefatigable.c stack.h bitableau.h solve.h game.h dfs.h
fortress.o: fortress.c stack.h bitableau.h solve.h game.h dfs.h
shamrocks.o: shamrocks.c stack.h bitableau.h solve.h game.h dfs.h
indef2.o: indef2.c stack.h bitableau.h solve.h game.h dfs.h
cruel.o: cruel.c stack.h tableau.h solve.h game.h dfs.h
agness.o: agness.c stack.h stock.h tableau.h solve.h game.h
kiev.o: kiev.c stack.h stock.h tableau.h solve.h game.h
scorpion.o: scorpion.c stack.h stock.h tableau.h solve.h game.h

inversions.o: inversions.c stack.h
cons.o: cons.c stack.h

clean:
	rm -f *.o captivequeens trigon doubletrigon randtest cq captivekings
